package com.changgou.search.lister;

import com.changgou.search.config.RabbitMQConfig;
import com.changgou.search.service.EsManagerService;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class GoodsUpListener {
  @Autowired
  private EsManagerService esManagerService;
     //更改商品为上架状态
    @RabbitListener(queues = RabbitMQConfig.GOODS_UP_QUEUE)
    public void receiveMessage(String spuId){
        System.out.println("接收到的消息为: "+spuId);
        //查询skulist,并导入到索引库
        esManagerService.importDataToESBySpuId(spuId);
    }
    //更改商品为下架状态
    @RabbitListener(queues = RabbitMQConfig.GOODS_DOWN_QUEUE)
    public void receiveMessage1(String spuId){
        System.out.println("接收到的消息为: "+spuId);
        //查询skulist,并导入到索引库
        esManagerService.delDataToESBySpuId(spuId);
    }
}
